<template>
	<view class="wanl-money">
		<view class="bg-orange padding-bj">
			<text class="title">金币（个）</text>
			<view class="margin-top margin-bottom-xs">
				<text class="text-sl">{{coin}}</text>
			</view>
		</view>
		<!-- 功能 -->
		
		<view class="cu-list menu sm-border">
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user2/coin/exchange')">
				<view class="content">
					<text class="wlIcon-yinhangka text-blue"></text>
					<text>金币兑换消费券</text>
				</view>
				<view class="action">
					<text class="text-sm wanl-gray">金币和消费券的兑换</text>
				</view>
			</view>
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user2/coin/list')">
				<view class="content">
					<text class="wlIcon-yue1 text-orange"></text>
					<text>金币明细</text>
				</view>
				<view class="action">
					<text class="text-sm wanl-gray">金币出入明细</text>
				</view>
			</view>
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user2/coin/exlist')">
				<view class="content">
					<text class="wlIcon-jinbitixian text-orange"></text>
					<text>兑换日志</text>
				</view>
				<view class="action">
					<text class="text-sm wanl-gray">金币兑换日志</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState } from 'vuex';
export default {
	data() {
		return {
			coin:0
		};
	},
	computed: {
		...mapState(['user'])
	},
	onLoad() {
		this.loadData();
	},
	methods: {
		async loadData() {
			await uni.request({
				url: '/wanlshop/pay/getCoin',
				method: 'POST',
				success: res => {
					this.coin = res.data;
					this.$store.commit('user/setUserInfo', {coin: res.data});
				}
			});
		}
	}
};
</script>

<style>
.wanl-money .title{
	color: rgba(255, 255, 255, .7);
}
</style>
